from pulp import *

prob = LpProblem("Max Flow Problem",LpMaximize)

e1 = LpVariable("Source Flow 1",0,3,LpInteger)
e2 = LpVariable("Source Flow 2",0,3,LpInteger)
e3 = LpVariable("Node Flow 1",0,2,LpInteger)
e4 = LpVariable("Node Flow 2",0,2,LpInteger)

prob += e1 + e2, "Maximum Flow"

prob += e1 - e3 <= 0, "Node 1 conversion positive"
prob += -e1 + e3 <= 0, "Node 1 conversion negative"

prob += e2 - e4 <= 0, "Node 2 conversion positive"
prob += -e2 + e4 <= 0, "Node 2 conversion negative"

prob.solve()

print "Status:", LpStatus[prob.status]

for variable in prob.variables():
    print variable.name, "=", variable.varValue

print "Maximum flow = ", value(prob.objective)
